<?php
/* @var $this CategorieController */
/* @var $model Categories */

$this->breadcrumbs=array(
	'Categories'=>array('index'),
	$model->name=>array('view','id'=>$model->id),
	'Update',
);

$this->menu=array(
	array('label'=>'List Categories', 'url'=>array('index')),
	array('label'=>'Create Categories', 'url'=>array('create')),
	array('label'=>'View Categories', 'url'=>array('view', 'id'=>$model->id)),
	array('label'=>'Manage Categories', 'url'=>array('admin')),
);
?>

<?php
$cs = Yii::app ()->clientScript;
$cs->registerScript('#yw0',
"
		$(document).ready(function(){
		   $('#yw0 li:last').addClass('current');
		});
"
);
?>

<div class="content-box">
<div class="content-box-header">
        <h3>更新分类 ：<?php echo $model->name; ?></h3>
        <ul class="content-box-tabs">
          <li><a href="#tab1" class="default-tab">表单</a></li>
        </ul>
        <div class="clear"></div>
 </div>
 <div class="content-box-content">
        <div class="tab-content default-tab" id="tab1">
		<?php $form=$this->beginWidget('CActiveForm', array(
			'id'=>'categories-form',
			// Please note: When you enable ajax validation, make sure the corresponding
			// controller action is handling ajax validation correctly.
			// There is a call to performAjaxValidation() commented in generated controller code.
			// See class documentation of CActiveForm for details on this.
			'enableAjaxValidation'=>false,
		)); ?>		
			<?php
			echo $form->errorSummary($model);
			?>
			
			<?php echo $form->hiddenField($model,'param',array('type'=>"hidden" , 'value'=>"")); ?>
			<?php echo $form->error($model,'param'); ?>
			
			<?php echo $form->hiddenField($model,'ordering',array('type'=>"ordering" , 'value'=>"0")); ?>
			<?php echo $form->error($model,'ordering'); ?>	
			
			
			<div class="row">
				<?php echo $form->labelEx($model,'name'); ?>
				<?php echo $form->textField($model,'name',array('size'=>60,'maxlength'=>200)); ?>
				<?php echo $form->error($model,'name'); ?>
			</div>
		
			<div class="row">
				<?php echo $form->labelEx($model,'parent'); ?>
				<?php //echo $form->textField($model,'parent',array('size'=>11,'maxlength'=>11)); 
						//echo $form->dropDownlist($model,'parent',CHtml::listData($model,'parent','name'));
						
						$list = CHtml::listData(Categories::model()->findAll(array('order' => 'id')), 'id', 'name');
						echo $form->dropDownList($model,'parent',$list);		
					?>
				<?php echo $form->error($model,'parent'); ?>
			</div>
		
			<div class="row">				
				<?php echo $form->labelEx($model,'category_image_url'); ?>
					<?php echo $form->fileField($model,'category_image_url',array('class' => 'text-input small-input' , 'value'=>$model->category_image_url)); ?>
                      <?php $form->error($model,'category_image_url'); ?>									
					<br>
					<?php if ($model->category_image_url){ ?>
						<img width="300px" src="<?php echo $model->category_image_url;?>" />
					<?php } ?>
				
			
			</div>
				
			<div class="row">
			<?php echo $form->labelEx($model,'排序号'); ?>			
			<?php echo $form->textField($model,'ordering',array('class' => 'text-input small-input')); ?>
			<?php echo $form->error($model,'ordering'); ?>
			</div>
			
			
			
			<div class="row">
					<?php echo $form->labelEx($model,'发布状态'); ?>
					<?php
						//$list = CHtml::listData(Categories::model()->findAll(array('order' => 'id')), 'id', 'published');
						$list = array( "1"=> "发布", "0" => "关闭");		
						echo $form->dropDownList($model,'published',$list);
					?>
					<?php echo $form->error($model,'published'); ?>
			</div>
		
		
			<div class="row buttons">
				<?php echo CHtml::submitButton('更新'); ?>
			</div>
		
		<?php $this->endWidget(); ?>
	</div>
</div>
</div>